package pe.edu.unmsm.fisi.sisconteg.business.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.dao.DataAccessException;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import pe.edu.unmsm.fisi.sisconteg.business.service.EmpresaService;
import pe.edu.unmsm.fisi.sisconteg.domain.model.Empresa;
import pe.edu.unmsm.fisi.sisconteg.repository.dao.EmpresaDAO;

@Service
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
public class EmpresaServiceImpl implements EmpresaService{

	@Resource
	EmpresaDAO empresaDao;
	
	@Override
	public List<Empresa> listarEmpresas() throws DataAccessException {
		return empresaDao.listEmpresas();
	}

	@Transactional(propagation = Propagation.REQUIRED, readOnly = false)
	@Override
	public void crearEmpresa(Empresa empresa) throws DataAccessException {
		empresaDao.crearEmpresa(empresa);
	}

}
